package cn.hbu.zlfw.common.base.service.impl;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.hbu.zlfw.common.base.dao.BaseDao;
import cn.hbu.zlfw.common.base.service.BaseService;
import cn.hbu.zlfw.common.util.PageModel;

/**
 * 
 *@ClassName:BaseServiceImpl.java
 *@Description:  公用的Service实现类
 *@Author:lxt<839376636@qq.com>
 *@Date:2017年10月6日下午6:44:31
 *@Version:1.1.0
 */
@Service("baseService")
@Transactional
public class BaseServiceImpl<T, PK extends Serializable> implements BaseService<T, PK> {


	@Autowired
	private BaseDao<T, PK> baseDao;

	@Override
	public PK save(T entity) {
		// TODO Auto-generated method stub
		return baseDao.save(entity);
	}

	@Override
	public void update(T entity) {
		// TODO Auto-generated method stub
		baseDao.update(entity);
	}

	@Override
	public T saveOrUpdate(T entity) {
		// TODO Auto-generated method stub
		return baseDao.saveOrUpdate(entity);
	}

	@Override
	public void delete(T entity) {
		// TODO Auto-generated method stub
		baseDao.delete(entity);
	}

	@Override
	public T getById(PK id) {
		// TODO Auto-generated method stub
		return baseDao.getById(id);
	}

	@Override
	public List<T> getByIds(PK[] ids) {
		// TODO Auto-generated method stub
		return baseDao.getByIds(ids);
	}

	@Override
	public List<T> findAll() {
		// TODO Auto-generated method stub
		return baseDao.findAll();
	}

	@Override
	public PageModel<T> findListByParams(String queryHql, String queryCount, Map<String, Object> params,
			PageModel<T> pageModel) {
		// TODO Auto-generated method stub
		return baseDao.findListByParams(queryHql, queryCount, params, pageModel);
	}

	@Override
	public void batchSave(List<T> list) {
		// TODO Auto-generated method stub
		baseDao.batchSave(list);
	}

	@Override
	public void batchUpdate(List<T> list) {
		// TODO Auto-generated method stub
		baseDao.batchUpdate(list);
	}

	@Override
	public void batchDelete(List<T> list) {
		// TODO Auto-generated method stub
		baseDao.batchDelete(list);
	}

	@Override
	public void batchsaveOrUpdate(List<T> list) {
		// TODO Auto-generated method stub
		baseDao.batchUpdate(list);
	}

	@Override
	public int deleteByIds(PK[] ids) {
		// TODO Auto-generated method stub
		return baseDao.deleteByIds(ids);
	}

    
	
}
